﻿using System.Collections.Generic;
using KLS.PPDS.Core.Entity;
using KLS.PPDS.Data.Database.Repository.RepositoryInterfaces;
using System.Linq;


namespace KLS.PPDS.Data.Database.Repository.EntityRepository
{
    public class RoleRepository: LinqRepository<Role>, IRoleRepository
    {
//        public IEnumerable<User> GetByCompanyId(int companyId)
//        {
//            var session = NHibernateHelper.GetCurrentSession();
//            string query = string.Format(@"from user u where u.Groups.Count>0 and u.Groups[0].Group.CompanyId=:cid                           
//                                order by u.UserName asc"
//                           );
//            IEnumerable<User> userList = session.CreateQuery(query).SetParameter("cid", companyId).Enumerable<User>();
//            return userList;
//        }

        public List<Role> GetAll()
         {
             return FindAll().OrderBy(c=>c.RoleName).ToList();
         }
    }
}
